#  Copyright (c) 2021.版权所有高金磊

# author:高金磊
# datetime:2021/12/6 20:20
from typing import List


class Solution:
    def allCellsDistOrder(self, rows: int, cols: int, rCenter: int, cCenter: int) -> List[List[int]]:
        res=[]
        for i in range(rows):
            for j in range(cols):
             res.append([abs(rCenter-i)+abs(cCenter-j),i,j])
        res.sort(key= lambda x:(x[0]))
        return [[i[0],i[1]] for i in res]
            
